/**
 * @author [siwi]
 * @email [siwi@siwi.me]
 * @create date 2017-08-19 03:17:57
 * @modify date 2017-08-19 03:17:57
 * @desc [siwi-json 测试]
*/

const Loadjson = require('../index')
const path = require('path')

class Test {
    constructor() {
        this.getDirJson()
        this.getJson()
    }
    async getDirJson() {
        console.log('测试获取文件夹内json文件内容')        
        let self = this
        let dir = path.join(__dirname, 'json')
        let content = await Loadjson.getDirJson(dir)
        console.log(content)
        for (let key in content) {
            console.log(`${key}:`, `${content[key]}`)
        }
    }
    async getJson() {
        console.log('测试获取单个json文件内容')      
        let self = this
        let json = path.join(__dirname, 'json', 'test.json')
        let content = await Loadjson.getJson(json)
        console.log(content)
        for (let key in content) {
            console.log(`${key}:`, `${content[key]}`)
        }
       
    }
}


module.exports = new Test()